Adversaries may execute their own malicious payloads by hijacking the search order used to load DLLs. Windows systems use a common method to look for required DLLs to load into a program. [1][2] Hijacking DLL loads may be for the purpose of establishing persistence as well as elevating privileges and/or evading restrictions on file execution.
There are many ways an adversary can hijack DLL loads. Adversaries may plant trojan dynamic-link library files (DLLs) in a directory that will be searched before the location of a legitimate library that will be requested by a program, causing Windows to load their malicious library when it is called for by the victim program. Adversaries may also perform DLL preloading, also called binary planting attacks, [3] by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program.[4] Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. [5]
Phantom DLL hijacking is a specific type of DLL search order hijacking where adversaries target references to non-existent DLL files.[6][7] They may be able to load their own malicious DLL by planting it with the correct name in the location of the missing module.
Adversaries may also directly modify the search order via DLL redirection, which after being enabled (in the Registry and creation of a redirection file) may cause a program to load a different DLL.[8][9][10]
If a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program. Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.
ID | Name | Description |
---|---|---|
G0096 | APT41 |
APT41 has used search order hijacking to execute malicious payloads, such as Winnti for Windows.[11] |
C0040 | APT41 DUST |
APT41 DUST involved the use of DLL search order hijacking to execute DUSTTRAP.[12] |
G0143 | Aquatic Panda |
Aquatic Panda has used DLL search-order hijacking to load |
S0373 | Astaroth |
Astaroth can launch itself via DLL Search Order Hijacking.[15] |
G0135 | BackdoorDiplomacy |
BackdoorDiplomacy has executed DLL search order hijacking.[16] |
S0415 | BOOSTWRITE |
BOOSTWRITE has exploited the loading of the legitimate Dwrite.dll file by actually loading the gdi library, which then loads the gdiplus library and ultimately loads the local Dwrite dll.[17] |
S1063 | Brute Ratel C4 |
Brute Ratel C4 has used search order hijacking to load a malicious payload DLL as a dependency to a benign application packaged in the same ISO.[18] |
S0631 | Chaes |
Chaes has used search order hijacking to load a malicious DLL.[19] |
G1021 | Cinnamon Tempest |
Cinnamon Tempest has used search order hijacking to launch Cobalt Strike Beacons.[20][21] |
S0538 | Crutch |
Crutch can persist via DLL search order hijacking on Google Chrome, Mozilla Firefox, or Microsoft OneDrive.[22] |
S0134 | Downdelph |
Downdelph uses search order hijacking of the Windows executable sysprep.exe to escalate privileges.[23] |
S0363 | Empire |
Empire contains modules that can discover and exploit various DLL hijacking opportunities.[24] |
G0120 | Evilnum |
Evilnum has used the malware variant, TerraTV, to load a malicious DLL placed in the TeamViewer directory, instead of the original Windows DLL located in a system folder.[25] |
S0182 | FinFisher |
A FinFisher variant uses DLL search order hijacking.[26][27] |
S0661 | FoggyWeb |
FoggyWeb's loader has used DLL Search Order Hijacking to load malicious code instead of the legitimate |
S0009 | Hikit |
Hikit has used DLL Search Order Hijacking to load |
S0070 | HTTPBrowser |
HTTPBrowser abuses the Windows DLL load order by using a legitimate Symantec anti-virus binary, VPDN_LU.exe, to load a malicious DLL that mimics a legitimate Symantec DLL, navlu.dll.[30] |
S1097 | HUI Loader |
HUI Loader can be deployed to targeted systems via legitimate programs that are vulnerable to DLL search order hijacking.[21] |
S0260 | InvisiMole |
InvisiMole can be launched by using DLL search order hijacking in which the wrapper DLL is placed in the same folder as explorer.exe and loaded during startup into the Windows Explorer process instead of the legitimate library.[31] |
S0530 | Melcoz |
Melcoz can use DLL hijacking to bypass security controls.[15] |
G0045 | menuPass | |
S0280 | MirageFox |
MirageFox is likely loaded via DLL hijacking into a legitimate McAfee binary.[33] |
S0013 | PlugX |
PlugX has the ability to use DLL search order hijacking for installation on targeted systems.[34] |
S0194 | PowerSploit |
PowerSploit contains a collection of Privesc-PowerUp modules that can discover and exploit DLL hijacking opportunities in services and processes.[35][36] |
S0113 | Prikormka |
Prikormka uses DLL search order hijacking for persistence by saving itself as ntshrui.dll to the Windows directory so it will load before the legitimate ntshrui.dll saved in the System32 subdirectory.[37] |
S0458 | Ramsay |
Ramsay can hijack outdated Windows application dependencies with malicious versions of its own DLL payload.[38] |
S0153 | RedLeaves |
RedLeaves is launched through use of DLL search order hijacking to load a malicious dll.[39] |
G0048 | RTM |
RTM has used search order hijacking to force TeamViewer to load a malicious DLL.[40] |
G0027 | Threat Group-3390 |
Threat Group-3390 has performed DLL search order hijacking to execute their payload.[41] |
G0131 | Tonto Team |
Tonto Team abuses a legitimate and signed Microsoft executable to launch a malicious DLL.[42] |
S0612 | WastedLocker |
WastedLocker has performed DLL hijacking before execution.[43] |
S0109 | WEBC2 |
Variants of WEBC2 achieve persistence by using DLL search order hijacking, usually by copying the DLL file to |
G0107 | Whitefly |
Whitefly has used search order hijacking to run the loader Vcrodat.[45] |
ID | Mitigation | Description |
---|---|---|
M1047 | Audit |
Use auditing tools capable of detecting DLL search order hijacking opportunities on systems within an enterprise and correct them. Toolkits like the PowerSploit framework contain PowerUp modules that can be used to explore systems for DLL hijacking weaknesses.[46] Use the program sxstrace.exe that is included with Windows along with manual inspection to check manifest files for side-by-side problems in software.[47] |
M1038 | Execution Prevention |
Adversaries may use new DLLs to execute this technique. Identify and block potentially malicious software executed through search order hijacking by using application control solutions capable of blocking DLLs loaded by legitimate software. |
M1044 | Restrict Library Loading |
Disallow loading of remote DLLs. This is included by default in Windows Server 2012+ and is available by patch for XP+ and Server 2003+. Enable Safe DLL Search Mode to force search for system DLLs in directories with greater restrictions (e.g. The Safe DLL Search Mode can be enabled via Group Policy at Computer Configuration > [Policies] > Administrative Templates > MSS (Legacy): MSS: (SafeDllSearchMode) Enable Safe DLL search mode. The associated Windows Registry key for this is located at |
ID | Data Source | Data Component | Detects |
---|---|---|---|
DS0022 | File | File Creation |
Monitor newly constructed .manifest and .local redirection files that do not correlate with software updates. |
File Modification |
Monitor for changed made to .manifest/.local redirection files, or file systems for moving, renaming, replacing, or modifying DLLs. Changes in the set of DLLs that are loaded by a process (compared with past behavior) that do not correlate with known software, patches, etc., are suspicious. |
||
DS0011 | Module | Module Load |
Monitor DLLs loaded into a process and detect DLLs that have the same file name but abnormal paths. |